package com.fanqiechaodan.responsibilitychain;

/**
 * @author fanqiechaodan
 * @Classname Demo
 * @Description 责任链模式
 */
public class Demo {

    public static void main(String[] args) {
        // 创建责任链
        Handler handlerA = new ConcreteHandlerA();
        Handler handlerB = new ConcreteHandlerB();
        handlerA.setNextHandler(handlerB);

        // 发送请求
        Request request1 = new Request(RequestType.TYPE_A,"请求A");
        handlerA.handle(request1);

        Request request2 = new Request(RequestType.TYPE_B,"请求B");
        handlerA.handle(request2);

        Request request3 = new Request(RequestType.TYPE_A,"请求C");
        handlerA.handle(request3);
    }
}
